home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
language
/
dl_exsrc.zoo
/
catch.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-07-03
|
348b
|
24 lines
#include <setjmp.h>
#include "extras.h"
static int hold_rv;
int catch(context, func)
jmp_buf context;
int (*func) __PROTO((void));
{
if (setjmp(context) == 0) {
return (*func)();
} else {
return hold_rv;
}
}
void throw(context, rv)
jmp_buf context;
int rv;
{
hold_rv = rv;
longjmp(context, 1);
}